package com.cleaningcloud.cld.service.impl;

import java.util.List;
import com.cleaningcloud.common.core.utils.DateUtils;
import com.cleaningcloud.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cleaningcloud.cld.mapper.CldCheckCycleMapper;
import com.cleaningcloud.cld.domain.CldCheckCycle;
import com.cleaningcloud.cld.service.ICldCheckCycleService;

/**
 * 考核周期Service业务层处理
 * 
 * @author cleaningcloud
 * @date 2024-10-12
 */
@Service
public class CldCheckCycleServiceImpl implements ICldCheckCycleService 
{
    @Autowired
    private CldCheckCycleMapper cldCheckCycleMapper;

    /**
     * 查询考核周期
     * 
     * @param cycleId 考核周期主键
     * @return 考核周期
     */
    @Override
    public CldCheckCycle selectCldCheckCycleByCycleId(Long cycleId)
    {
        return cldCheckCycleMapper.selectCldCheckCycleByCycleId(cycleId);
    }

    /**
     * 查询考核周期列表
     * 
     * @param cldCheckCycle 考核周期
     * @return 考核周期
     */
    @Override
    public List<CldCheckCycle> selectCldCheckCycleList(CldCheckCycle cldCheckCycle)
    {
        return cldCheckCycleMapper.selectCldCheckCycleList(cldCheckCycle);
    }

    /**
     * 新增考核周期
     * 
     * @param cldCheckCycle 考核周期
     * @return 结果
     */
    @Override
    public int insertCldCheckCycle(CldCheckCycle cldCheckCycle)
    {
        cldCheckCycle.setCreateTime(DateUtils.getNowDate());
        cldCheckCycle.setCycleId(SecurityUtils.getUserId());
        cldCheckCycle.setCreateName(SecurityUtils.getUsername());
        cldCheckCycle.setFlag(0L);
        return cldCheckCycleMapper.insertCldCheckCycle(cldCheckCycle);
    }

    /**
     * 修改考核周期
     * 
     * @param cldCheckCycle 考核周期
     * @return 结果
     */
    @Override
    public int updateCldCheckCycle(CldCheckCycle cldCheckCycle)
    {
        return cldCheckCycleMapper.updateCldCheckCycle(cldCheckCycle);
    }

    /**
     * 批量删除考核周期
     * 
     * @param cycleIds 需要删除的考核周期主键
     * @return 结果
     */
    @Override
    public int deleteCldCheckCycleByCycleIds(Long[] cycleIds)
    {
        return cldCheckCycleMapper.deleteCldCheckCycleByCycleIds(cycleIds);
    }

    /**
     * 删除考核周期信息
     * 
     * @param cycleId 考核周期主键
     * @return 结果
     */
    @Override
    public int deleteCldCheckCycleByCycleId(Long cycleId)
    {
        return cldCheckCycleMapper.deleteCldCheckCycleByCycleId(cycleId);
    }
}
